<template>
  <div class="index-search">
    <i class="iconfont bee-mulu"></i>
    <div class="search" @touchstart="jump">
      <div class="title">新蜂商城</div>
      <div class="separator"></div>
      <div class="text">
        华为mate40
      </div>
    </div>
    <div>
      <div v-if="!(userInfo && userInfo.loginName)" class="login-text">
        登录
      </div>
      <i v-else class="iconfont bee-search-user"></i>
    </div>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
  name: 'IndexSearch',
  data() {
    return {}
  },
  computed: {
    ...mapGetters({
      userInfo: 'user/getUserInfo'
    })
  },
  methods: {
    jump() {
      this.$router.push({ path: '/list' })
    }
  }
}
</script>

<style lang="less" scoped>
@import '../../common/style/mixin.less';
.index-search {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  height: 50px;
  padding: 0 15px;
  background-color: @primary;
  .bee-mulu {
    font-size: 20px;
    color: #fff;
  }
  .search {
    display: inline-flex;
    align-items: center;
    width: 250px;
    height: 30px;
    line-height: 30px;
    padding: 0 20px;
    background-color: hsla(0, 0, 100%, 0.7);
    border-radius: 25px;
    .title {
      font-size: 16px;
      font-weight: bold;
      color: @primary;
    }
    .separator {
      width: 0;
      height: 16px;
      margin: 0 15px 0 10px;
      border-right: 1px solid #666;
    }
    .text {
      font-size: 12px;
      color: #666;
    }
  }
  .bee-search-user {
    font-size: 22px;
    color: #fff;
  }
  .login-text {
    color: #fff;
    font-size: 14px;
  }
}
</style>
